package com.tabview.difficultpoint;

import android.content.Context;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.xudow.app.R;

/**
 * 作者：zhouXJ on 2016/3/30 14:27
 */
public class AttendanceHolder {

    private Context context;
    private TextView attendance_item_lesson_num;
    private TextView attendance_item_state;

    public AttendanceHolder(View view, Context context) {
        this.context = context;
        attendance_item_lesson_num = (TextView) view.findViewById(R.id.attendance_item_lesson_num);
        attendance_item_state = (TextView) view.findViewById(R.id.attendance_item_state);
    }

    public void bind(CourseDifficultPointContent attendance) {
        attendance_item_lesson_num.setText(attendance.getTimes());
        String attendanceStr = attendance.getAttendance();
        attendance_item_state.setText(attendanceStr);
        if (!TextUtils.isEmpty(attendanceStr)) {
            if (attendanceStr.equals("正常")) {
                attendance_item_state.setTextColor(Color.parseColor("#1797e0"));

            } else if (attendanceStr.equals("迟到") || attendanceStr.equals("早退") ||
                    attendanceStr.equals("旷课")) {
                attendance_item_state.setTextColor(Color.parseColor("#f00000"));

            } else if (attendanceStr.equals("请假")) {
                attendance_item_state.setTextColor(Color.parseColor("#7fc524"));

            } else {
                attendance_item_state.setTextColor(Color.parseColor("#000000"));
            }

        }
    }
}
